< previous page page_150 next page >

Page 150
3. Click the check box next to the control named Microsoft Common Dialog Control 6.0, making sure a check mark appears in the box.
4. Click OK to close the Components dialog box.
5. When you see the CommonDialog tool in the Toolbox, double-click it to add a common dialog control to Form1.
6. Set the CommonDialog control's Name property to cdlTest.
7. Add a command button to Form1. Set its Name property to cmdTest and its Caption property to Test Common Dialog.
You'll use this shell program to see how the various flavors of the CommonDialog control work. When instructed, enter code into cmdTest's Click event procedure.
The File Dialog Boxes
One of the key uses of the CommonDialog control is to obtain file names from the user. The CommonDialog control's File dialog box can be used in either of two modes: Open and Save As. Open mode lets the user specify the name and location of a file to be retrieved and used by your program. Save As mode lets the user specify the name and location of a file to be saved.
Open and Save As Dialog Boxes
The dialog boxes for the Open and Save As functions are similar. Figure 7.6 shows the Open dialog box.
0150-01.jpg
Figure 7.6
The Open and Save dialog
boxes share many components.
The dialog box's major components are as follows:
Drive/Folder list. The current folder is listed here. If the current folder is the root (\), the current drive is listed here. You can use the combo box and navigation buttons to move up folder levels, similar to the way you would in the Windows Explorer.
File/Folder selection list. The names indicated in this area are the folders and files one level beneath the item in the Drive/Folder list. An item in this area can be opened either by double-clicking it, or by highlighting it and pressing Enter. If the item you open is a folder, the display is updated to show the contents of the new current folder. If the item you open is a file, the dialog box closes.
File Name text box. The user can use this text box for manual filename entry and folder navigation. If the user enters a filename, the dialog box closes. If he or she enters

 
< previous page page_150 next page >